import 'package:flutter_yn_goods/pages/agreement/model/model_agreement.dart';
import 'package:flutter_yn_goods/utils/http/http_export.dart';
import 'package:get/get.dart';

class AgreementLogic extends GetxController {
  var code = Get.arguments;

  ModelAgreement agreement = ModelAgreement();

  @override
  void onReady() {
    // TODO: implement onReady
    super.onReady();
  }

  @override
  void onClose() {
    // TODO: implement onClose
    super.onClose();
  }

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
    getDataSource();
  }

  getDataSource() async {
    HttpResponse response = await HttpManager().get(
        API.getAgreement + code.toString(),
        uiType: HttpUIType.loadingAndToast,
        fromJson: ModelAgreement.fromJson);
    if (response.isSuccess) {
      agreement = response.data;
      update();
    }
  }
}
